<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf"
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
                    xmlns:materialdesign="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
                    xmlns:DentalGUIHelper="clr-namespace:DentalGUIHelper;assembly=DentalConfig"
                    xmlns:dentalConverters="clr-namespace:DentalConfig.Converters;assembly=DentalConfig">

  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="../Brushes/MaterialDesign/MaterialDesignTheme.Theme.xaml"/>
    <ResourceDictionary Source="../Brushes/Fonts.xaml"/>
    <ResourceDictionary Source="MaterialDesignTheme.Shadows.xaml" />
    <ResourceDictionary Source="MaterialDesignTheme.ValidationErrorTemplate.xaml" />
  </ResourceDictionary.MergedDictionaries>

  <converters:TextFieldHintVisibilityConverter x:Key="TextFieldHintVisibilityConverter" IsNotEmptyValue="Collapsed" />
  <converters:MathConverter x:Key="MathAddConverter" Operation="Add" />
  <converters:BrushRoundConverter x:Key="BrushRoundConverter" />
  <converters:BooleanToVisibilityConverter x:Key="InverseBoolToVisConverter" TrueValue="Collapsed" FalseValue="Visible"/>
  <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
  <dentalConverters:TranslationConverter x:Key="TranslationConverter"/>
  <dentalConverters:IsStringNullOrEmptyConverter x:Key="StringNullOrEmpty"/>
  <dentalConverters:BrushToTransmittantBrushConverter x:Key="BrushToTransmittantBrushConverter"/>
  <system:String x:Key="selectAnOption">SelectAnOption</system:String>

  <system:Double x:Key="PopupContentPresenterExtend">4</system:Double>
  <system:Double x:Key="PopupTopBottomMargin">8</system:Double>
  <system:Double x:Key="PopupLeftRightMargin">16</system:Double>
  <system:Boolean x:Key="TrueValue">True</system:Boolean>
  <system:Boolean x:Key="FalseValue">False</system:Boolean>

  <Style x:Key="FocusVisual">
    <Setter Property="Control.Template">
      <Setter.Value>
        <ControlTemplate>
          <Rectangle Margin="2 2 2 2"
                     SnapsToDevicePixels="true"
                     Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
                     StrokeDashArray="1 2"
                     StrokeThickness="1" />
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="PopupContentUpTemplate" TargetType="ContentControl">
    <Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}"
          Margin="6">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Border Background="Transparent"
              BorderBrush="{DynamicResource MaterialDesignShadowBrush}"
              BorderThickness="1"
              CornerRadius="2">
        <Border.Effect>
          <BlurEffect Radius="6"/>
        </Border.Effect>
      </Border>
      <Grid Margin="1">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                CornerRadius="2 2 0 0"
                Background="{DynamicResource MaterialDesignContextMenuBackground}"
                Height="{StaticResource PopupTopBottomMargin}"/>
        <ContentPresenter Grid.Row="1"/>
        <Border Grid.Row="2"
                Background="{DynamicResource MaterialDesignContextMenuBackground}"
                Height="{StaticResource PopupContentPresenterExtend}"/>

        <Grid Grid.Row="3">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Border Grid.Column="0"
                  Width="{StaticResource PopupLeftRightMargin}"
                 Background="{DynamicResource MaterialDesignContextMenuBackground}"/>
          <Grid Grid.Column="1"
                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpf:ComboBoxPopup}}, Path=VisiblePlacementWidth}"
                Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
          <Border Grid.Column="2"
                  MinWidth="{StaticResource PopupLeftRightMargin}"
                  Background="{DynamicResource MaterialDesignContextMenuBackground}"/>
        </Grid>

        <Border Grid.Row="4"
                CornerRadius="0 0 2 2"
                Height="{StaticResource PopupTopBottomMargin}"
                Background="{DynamicResource MaterialDesignContextMenuBackground}" />
      </Grid>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="PopupContentDownTemplate" TargetType="ContentControl">
    <Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}"
          Margin="6">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Border Background="Transparent"
              BorderBrush="{DynamicResource MaterialDesignShadowBrush}"
              BorderThickness="1"
              CornerRadius="2">
        <Border.Effect>
          <BlurEffect Radius="6"/>
        </Border.Effect>
      </Border>
      <Grid Margin="1"
            SnapsToDevicePixels="True">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                CornerRadius="2 2 0 0"
                Background="{DynamicResource MaterialDesignContextMenuBackground}"
                Height="{StaticResource PopupTopBottomMargin}"/>

        <Grid Grid.Row="1">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Border Grid.Column="0"
                  Width="{StaticResource PopupLeftRightMargin}"
                  Background="{DynamicResource MaterialDesignContextMenuBackground}"
                               />
          <Grid Grid.Column="1"
                Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type wpf:ComboBoxPopup}}, Path=VisiblePlacementWidth}"
                Height="{Binding ElementName=templateRoot, Path=ActualHeight}"/>
          <Border Grid.Column="2"
                  MinWidth="{StaticResource PopupLeftRightMargin}"
                  Background="{DynamicResource MaterialDesignContextMenuBackground}"
                               />
        </Grid>

        <Border Grid.Row="2"
                Background="{DynamicResource MaterialDesignContextMenuBackground}"
                Height="{StaticResource PopupContentPresenterExtend}"/>

        <ContentPresenter Grid.Row="3"/>

        <Border Grid.Row="4"
                CornerRadius="0 0 2 2"
                Height="{StaticResource PopupTopBottomMargin}"
                Background="{DynamicResource MaterialDesignContextMenuBackground}" />
      </Grid>
    </Grid>
  </ControlTemplate>

  <ControlTemplate x:Key="PopupContentClassicTemplate" TargetType="ContentControl">
    <Grid MinWidth="{Binding ElementName=templateRoot, Path=ActualWidth, Converter={StaticResource MathAddConverter}, ConverterParameter=32}"
          Margin="6">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Border Background="Transparent"
              BorderBrush="{DynamicResource MaterialDesignShadowBrush}"
              BorderThickness="1"
              CornerRadius="2">
        <Border.Effect>
          <BlurEffect Radius="6"/>
        </Border.Effect>
      </Border>
      <Grid Margin="1">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto"/>
          <RowDefinition Height="*"/>
          <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                CornerRadius="2 2 0 0"
                Background="{DynamicResource MaterialDesignContextMenuBackground}"
                Height="{StaticResource PopupTopBottomMargin}"/>

        <ContentPresenter Grid.Row="1"/>

        <Border Grid.Row="2"
                CornerRadius="0 0 2 2"
                Height="{StaticResource PopupTopBottomMargin}"
                Background="{DynamicResource MaterialDesignContextMenuBackground}" />
      </Grid>
    </Grid>
  </ControlTemplate>

  <Style x:Key="MaterialDesignComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="AllowDrop" Value="true" />
    <Setter Property="MinWidth" Value="0" />
    <Setter Property="MinHeight" Value="0" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
    <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
    <Setter Property="ContextMenu">
      <Setter.Value>
        <ContextMenu Style="{DynamicResource MaterialDesignContextMenu}">
          <MenuItem Command="ApplicationCommands.Cut"/>
          <MenuItem Command="ApplicationCommands.Copy"/>
          <MenuItem Command="ApplicationCommands.Paste"/>
        </ContextMenu>
      </Setter.Value>
    </Setter>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBox}">
          <Grid>
            <ScrollViewer x:Name="PART_ContentHost"
                          Focusable="false"
                          HorizontalScrollBarVisibility="Hidden"
                          VerticalScrollBarVisibility="Hidden" />
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="MaterialDesignComboBoxItemTemplate" TargetType="{x:Type ComboBoxItem}">
    <Grid x:Name="GridWrapper">
      <VisualStateManager.VisualStateGroups>
        <VisualStateGroup Name="CommonStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0:0:0.3" To="Normal">
              <VisualTransition.GeneratedEasingFunction>
                <CircleEase EasingMode="EaseOut" />
              </VisualTransition.GeneratedEasingFunction>
            </VisualTransition>
          </VisualStateGroup.Transitions>
          <VisualState Name="Normal" />
          <VisualState Name="MouseOver">
            <Storyboard>
              <DoubleAnimation Duration="0"
                               Storyboard.TargetName="MouseOverBorder"
                               Storyboard.TargetProperty="Opacity"
                               To="0.1" />
            </Storyboard>
          </VisualState>
        </VisualStateGroup>
        <VisualStateGroup Name="SelectionStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0:0:0.3" />
          </VisualStateGroup.Transitions>
          <VisualState Name="Selected">
            <Storyboard>
              <DoubleAnimation Duration="0"
                               Storyboard.TargetName="SelectedBorder"
                               Storyboard.TargetProperty="Opacity"
                               To="0.18" />
            </Storyboard>
          </VisualState>
          <VisualState Name="Unselected" />
        </VisualStateGroup>
        <VisualStateGroup Name="FocusStates">
          <VisualStateGroup.Transitions>
            <VisualTransition GeneratedDuration="0:0:0.05" To="Unfocused" />
          </VisualStateGroup.Transitions>
          <VisualState Name="Focused">
            <Storyboard>
              <DoubleAnimation Duration="0"
                               Storyboard.TargetName="MouseOverBorder"
                               Storyboard.TargetProperty="Opacity"
                               To="0.1" />
            </Storyboard>
          </VisualState>
          <VisualState Name="Unfocused" />
        </VisualStateGroup>
      </VisualStateManager.VisualStateGroups>
      <Border x:Name="BackBorder"
              Background="{TemplateBinding Background}"
              BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}"
              SnapsToDevicePixels="true" />

      <Border x:Name="MouseOverBorder"
              Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"
              BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}"
              Opacity="0"
              SnapsToDevicePixels="true" />
      <Border x:Name="SelectedBorder"
              Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"
              Opacity="0"
              RenderTransformOrigin="0.5,0.5" />
      <wpf:Ripple HorizontalAlignment="Stretch"
                  VerticalAlignment="Stretch"
                  HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                  VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                  Content="{TemplateBinding Content}"
                  ContentTemplate="{TemplateBinding ContentTemplate}"
                  ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                  Feedback="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"
                  Focusable="False"
                  Padding="{TemplateBinding Padding}"
                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="GridWrapper" Property="Opacity" Value="{StaticResource DisabledOpacity}" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Tag" Value="1.0" />
          <Condition Property="IsSelected" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="Height" Value="0"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style x:Key="MaterialDesignComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Padding" Value="20 8 8 8" />
    <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}, FallbackValue=Stretch}" />
    <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}, FallbackValue=Center}" />
    <Setter Property="Foreground" Value="{DynamicResource MaterialDesignContextMenuForeground}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="BorderBrush" Value="Transparent" />
    <Setter Property="BorderThickness" Value="0" />
    <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
    <Setter Property="Template" Value="{StaticResource MaterialDesignComboBoxItemTemplate}" />
  </Style>

  <Style x:Key="MaterialDesignComboBoxItemSelectedCollapsedStyle"
         BasedOn="{StaticResource MaterialDesignComboBoxItemStyle}"
         TargetType="{x:Type ComboBoxItem}">
    <Setter Property="Tag" Value="1.0" />
  </Style>

  <Style x:Key="MaterialDesignComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="ClickMode" Value="Press" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid>
            <Border x:Name="ToggleTemplateRoot"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
              <Border x:Name="splitBorder"
                      Margin="0"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      BorderBrush="Transparent"
                      BorderThickness="0">
                <Path x:Name="arrow"
                              Width="8" Height="8"
                              Margin="4"
                              Stretch="Uniform"
                              HorizontalAlignment="Right"
                              VerticalAlignment="Center"
                              Data="M7,10L12,15L17,10H7Z"
                              Fill="{TemplateBinding BorderBrush}" />
              </Border>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
              </MultiDataTrigger.Conditions>
            </MultiDataTrigger>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
              </MultiDataTrigger.Conditions>
              <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
            </MultiDataTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="arrow" Property="Fill" Value="{DynamicResource MidContrastPrimaryBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter TargetName="arrow" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
              <Setter TargetName="arrow" Property="Opacity" Value="0.74" />
            </Trigger>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="Transparent"/>
            </MultiDataTrigger>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="Transparent"/>
              <Setter TargetName="splitBorder" Property="BorderBrush" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
              <Setter TargetName="splitBorder" Property="Opacity" Value="0.74" />
            </MultiDataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

    <Style x:Key="MaterialDesignRotatingComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
      <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
      <Setter Property="OverridesDefaultStyle" Value="true" />
      <Setter Property="IsTabStop" Value="false" />
      <Setter Property="Focusable" Value="false" />
      <Setter Property="ClickMode" Value="Press" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToggleButton}">
            <Grid>
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CheckStates">
                  <VisualStateGroup.Transitions>
                    <VisualTransition From="Unchecked" To="Checked">
                      <VisualTransition.GeneratedEasingFunction>
                        <QuarticEase EasingMode="EaseOut"/>
                      </VisualTransition.GeneratedEasingFunction>
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                          <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition GeneratedDuration="0" To="Unchecked">
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition GeneratedDuration="0" To="Checked">
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition From="Checked" GeneratedDuration="0" To="Unchecked">
                      <VisualTransition.GeneratedEasingFunction>
                        <QuarticEase EasingMode="EaseOut"/>
                      </VisualTransition.GeneratedEasingFunction>
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                          <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                  </VisualStateGroup.Transitions>
                  <VisualState x:Name="Checked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Unchecked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Border x:Name="ToggleTemplateRoot"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}">
                <Border x:Name="splitBorder"
                        Margin="0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        BorderBrush="Transparent"
                        BorderThickness="0">
                  <Border Background="Transparent">
                    <Path x:Name="arrow"
                          Width="8" Height="8"
                          RenderTransformOrigin="0.5,0.5"
                          Margin="4"
                          Stretch="Uniform"
                          HorizontalAlignment="Right"
                          VerticalAlignment="Center"
                          Data="M7,10L12,15L17,10H7Z"
                          Fill="{TemplateBinding BorderBrush}" >
                      <Path.RenderTransform>
                        <TransformGroup>
                          <ScaleTransform/>
                          <SkewTransform/>
                          <RotateTransform/>
                          <TranslateTransform/>
                        </TransformGroup>
                      </Path.RenderTransform>
                    </Path>
                  </Border>
                </Border>
              </Border>
            </Grid>
            <ControlTemplate.Triggers>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
                </MultiDataTrigger.Conditions>
              </MultiDataTrigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
                </MultiDataTrigger.Conditions>
                <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
              </MultiDataTrigger>
              <Trigger Property="IsPressed" Value="true">
                <Setter TargetName="arrow" Property="Fill" Value="{DynamicResource MidContrastPrimaryBrush}" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="arrow" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
                <Setter TargetName="arrow" Property="Opacity" Value="0.74" />
              </Trigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
                </MultiDataTrigger.Conditions>
                <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="Transparent"/>
              </MultiDataTrigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
                </MultiDataTrigger.Conditions>
                <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="Transparent"/>
                <Setter TargetName="splitBorder" Property="BorderBrush" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
                <Setter TargetName="splitBorder" Property="Opacity" Value="0.74" />
              </MultiDataTrigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <Style x:Key="MaterialDesignNoColorHighlightRotatingComboBoxToggleButton" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource MaterialDesignRotatingComboBoxToggleButton}">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToggleButton}">
            <Grid>
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CheckStates">
                  <VisualStateGroup.Transitions>
                    <VisualTransition From="Unchecked" To="Checked">
                      <VisualTransition.GeneratedEasingFunction>
                        <QuarticEase EasingMode="EaseOut"/>
                      </VisualTransition.GeneratedEasingFunction>
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                          <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition GeneratedDuration="0" To="Unchecked">
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition GeneratedDuration="0" To="Checked">
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                    <VisualTransition From="Checked" GeneratedDuration="0" To="Unchecked">
                      <VisualTransition.GeneratedEasingFunction>
                        <QuarticEase EasingMode="EaseOut"/>
                      </VisualTransition.GeneratedEasingFunction>
                      <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                          <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                          <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                      </Storyboard>
                    </VisualTransition>
                  </VisualStateGroup.Transitions>
                  <VisualState x:Name="Checked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Unchecked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Border x:Name="ToggleTemplateRoot"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}"
                      CornerRadius="2"/>
              <Grid Background="Transparent"
                    Margin="{TemplateBinding Padding}"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center">
                <Path x:Name="arrow"
                      Width="8" Height="8"
                      RenderTransformOrigin="0.5,0.5"
                      Margin="4"
                      Stretch="Uniform"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      Data="M7,10L12,15L17,10H7Z"
                      Fill="{TemplateBinding BorderBrush}" >
                  <Path.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform/>
                      <SkewTransform/>
                      <RotateTransform/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </Path.RenderTransform>
                </Path>
              </Grid>
            </Grid>
            <ControlTemplate.Triggers>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
                </MultiDataTrigger.Conditions>
              </MultiDataTrigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
                </MultiDataTrigger.Conditions>
                <Setter Property="BorderThickness" Value="2" />
              </MultiDataTrigger>
              <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="arrow" Property="Fill" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
                <Setter TargetName="arrow" Property="Opacity" Value="0.74" />
              </Trigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
                </MultiDataTrigger.Conditions>
                <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.76}"/>
              </MultiDataTrigger>
              <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                  <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
                  <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
                </MultiDataTrigger.Conditions>
                <Setter TargetName="ToggleTemplateRoot" Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.76}"/>
              </MultiDataTrigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <ControlTemplate x:Key="MaterialDesignFloatingHintComboBoxTemplate" TargetType="{x:Type ComboBox}">
      <Grid x:Name="templateRoot"
            Background="{TemplateBinding Background}"
            ToolTip="{Binding Path=ToolTip, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}, FallbackValue={x:Null}}"
            SnapsToDevicePixels="True">
        <Grid x:Name="InnerRoot">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
          </Grid.ColumnDefinitions>
          <ToggleButton x:Name="toggleButton"
                        Grid.ColumnSpan="2"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                        Style="{StaticResource MaterialDesignRotatingComboBoxToggleButton}"/>
          <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                Margin="{TemplateBinding Padding}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
            <Grid x:Name="InputRoot"
                  HorizontalAlignment="Left">
              <ContentPresenter x:Name="contentPresenter"
                                Content="{TemplateBinding SelectionBoxItem}"
                                ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                                ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                IsHitTestVisible="False"/>
              <TextBox x:Name="PART_EditableTextBox"
                       IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                       HorizontalAlignment="Left"
                       HorizontalContentAlignment="Stretch"
                       Style="{StaticResource MaterialDesignComboBoxEditableTextBox}"
                       CaretBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}"
                       Visibility="Collapsed" />

              <wpf:SmartHint x:Name="Hint"
                             HintProxy="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:HintProxyFabricConverter.Instance}}"
                             FontSize="{TemplateBinding FontSize}"
                             SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                             UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                             UseFloating="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource TemplatedParent}}"
                             FloatingScale="{Binding Path=(wpf:HintAssist.FloatingScale), RelativeSource={RelativeSource TemplatedParent}}"
                             FloatingOffset="{Binding Path=(wpf:HintAssist.FloatingOffset), RelativeSource={RelativeSource TemplatedParent}}"
                             HintOpacity="{Binding Path=(wpf:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}">
                <wpf:SmartHint.Resources>
                  <system:Double x:Key="DisabledOpacity">1</system:Double><!--TextBlock disabled opacity should not be applied on top of HintOpacity-->
                </wpf:SmartHint.Resources>
                <wpf:SmartHint.Hint>
                  <StackPanel Orientation="Horizontal">
                    <ContentPresenter Content="{Binding Path=(wpf:HintAssist.Hint), RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                    <TextBlock Text="*" Margin="4,0,0,0" VerticalAlignment="Center" Visibility="{Binding Path=(DentalGUIHelper:TextboxHelper.IsRequired), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                  </StackPanel>
                </wpf:SmartHint.Hint>
              </wpf:SmartHint>
            </Grid>
          </Grid>
          <Line x:Name="DashedLine" Grid.ColumnSpan="2" VerticalAlignment="Bottom"
                Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource InverseBoolToVisConverter}}"
                StrokeThickness="1.25" StrokeDashArray="1,2.5" StrokeDashCap="Round"
                X1="0" X2="{Binding ActualWidth, ElementName=toggleButton}" Y1="0" Y2="0"
                Stroke="{TemplateBinding BorderBrush}" />
          <wpf:Underline x:Name="Underline"
                         Grid.ColumnSpan="2"
                         IsActive="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen}"
                         Visibility="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/>

          <wpf:ComboBoxPopup x:Name="PART_Popup"
                             AllowsTransparency="true"
                             Background="{DynamicResource MaterialDesignContextMenuBackground}"
                             Focusable="False"
                             HorizontalOffset="-11.5"
                             IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                             PlacementTarget="{Binding ElementName=templateRoot}"
                             SnapsToDevicePixels="True"
                             UseLayoutRounding="True"
                             Placement="Custom"
                             PopupAnimation="Fade"
                             VerticalOffset="0"
                             DefaultVerticalOffset="5"
                             DownVerticalOffset="-15.5"
                             UpVerticalOffset="15"
                             ClassicMode="{Binding Path=(wpf:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}"
                             UpContentTemplate="{StaticResource PopupContentUpTemplate}"
                             DownContentTemplate="{StaticResource PopupContentDownTemplate}"
                             ClassicContentTemplate="{StaticResource PopupContentClassicTemplate}">
            <ContentControl>
              <GroupBox x:Name="ItemContainerGroupBox" Style="{DynamicResource MaterialDesignFlatGroupBox}" Padding="0" MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}">
                <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
                              Background="{DynamicResource MaterialDesignContextMenuBackground}">
                  <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
                </ScrollViewer>
              </GroupBox>
            </ContentControl>
          </wpf:ComboBoxPopup>
        </Grid>
      </Grid>
      <ControlTemplate.Triggers>
        <Trigger SourceName="PART_Popup" Property="PopupPlacement" Value="{x:Static materialdesign:ComboBoxPopupPlacement.Classic}">
          <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
        </Trigger>
        <Trigger Property="wpf:ComboBoxAssist.ClassicMode" Value="True">
          <Setter TargetName="PART_Popup" Property="Placement" Value="Bottom"/>
          <Setter TargetName="ItemContainerGroupBox" Property="Style" Value="{DynamicResource MaterialDesignNoColorRaisedCardGroupBox}"/>
          <Setter TargetName="ItemContainerGroupBox" Property="Margin" Value="4"/>
          <Setter TargetName="ItemContainerGroupBox" Property="Padding" Value="0,2"/>
          <Setter TargetName="ItemContainerGroupBox" Property="Background" Value="{DynamicResource MaterialDesignContextMenuBackground}"/>
          <Setter TargetName="ItemContainerGroupBox" Property="MinWidth" Value="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MathAddConverter}, ConverterParameter=15}"/>
        </Trigger>
        <Trigger Property="HasItems" Value="False">
          <Setter TargetName="PART_Popup" Property="IsOpen" Value="False"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
          <Setter TargetName="templateRoot" Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
          <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
          <Setter TargetName="Hint" Property="HintOpacity" Value="1"/>
        </Trigger>
        <Trigger Property="IsEditable" Value="True">
          <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
          <Setter TargetName="Underline" Property="Visibility" Value="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}" />
          <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
        </Trigger>
		<Trigger Property="DentalGUIHelper:ComboBoxBehavior.IsEditableComboBoxDisableTextBox" Value="True">
          <Setter TargetName="PART_EditableTextBox" Property="IsEnabled" Value="false" />
		  <Setter TargetName="PART_EditableTextBox" Property="TextWrapping" Value="Wrap" />
		  <Setter TargetName="PART_EditableTextBox" Property="AcceptsReturn" Value="True" />
        </Trigger>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource Self}}" Value="True" />
            <Condition Binding="{Binding Path=(wpf:HintAssist.Hint), RelativeSource={RelativeSource Self}, Converter={StaticResource StringNullOrEmpty}}" Value="False"/>
          </MultiDataTrigger.Conditions>
          <Setter TargetName="InnerRoot" Property="Margin" Value="0 20 0 0" />
        </MultiDataTrigger>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding Path=(IsEditable), RelativeSource={RelativeSource Self}}" Value="True" />
            <Condition Binding="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource Self}}" Value="False" />
            <Condition Binding="{Binding Path=(DentalGUIHelper:TextboxHelper.HintIsVisible), RelativeSource={RelativeSource Self}}" Value="False"/>
          </MultiDataTrigger.Conditions>
          <Setter TargetName="Hint" Property="Visibility" Value="Collapsed" />
        </MultiDataTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsEditable" Value="False"/>
            <Condition Property="IsDropDownOpen" Value="True"/>
            <Condition Property="wpf:ComboBoxAssist.ClassicMode" Value="False"/>
          </MultiTrigger.Conditions>
          <Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
          <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
            <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
            <Condition Property="IsKeyboardFocusWithin" Value="True" />
          </MultiTrigger.Conditions>
          <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
          <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
            <Condition SourceName="Hint" Property="IsHintInFloatingPosition" Value="True" />
            <Condition Property="IsKeyboardFocusWithin" Value="True" />
          </MultiTrigger.Conditions>
          <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
          <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
            <Condition SourceName="PART_EditableTextBox" Property="IsKeyboardFocused" Value="True" />
          </MultiTrigger.Conditions>
          <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
          <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
            <Condition Property="IsDropDownOpen" Value="True" />
          </MultiTrigger.Conditions>
          <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
          <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsGrouping" Value="true" />
            <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
          </MultiTrigger.Conditions>
          <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
        </MultiTrigger>
        <Trigger Property="IsKeyboardFocused" Value="true">
          <Setter TargetName="Underline" Property="IsActive" Value="True"/>
        </Trigger>
        <Trigger Property="Validation.HasError" Value="true">
          <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
          <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
        </Trigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="Validation.HasError" Value="True"/>
            <Condition Property="wpf:ValidationAssist.Suppress" Value="True"/>
          </MultiTrigger.Conditions>
          <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/>
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsMouseOver" Value="true" />
            <Condition Property="Validation.HasError" Value="true" />
          </MultiTrigger.Conditions>
          <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
          <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
        </MultiTrigger>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsMouseOver" Value="true" />
            <Condition Property="Validation.HasError" Value="false" />
          </MultiTrigger.Conditions>
          <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}"/>
          <Setter TargetName="Underline" Property="Background" Value="{DynamicResource MidContrastPrimaryBrush}"/>
        </MultiTrigger>
      </ControlTemplate.Triggers>
    </ControlTemplate>

  <Style x:Key="MaterialDesignMinimalistComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="ClickMode" Value="Press" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid>
            <Border x:Name="ToggleTemplateRoot"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
              <Border x:Name="splitBorder"
                      Margin="0"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      BorderBrush="Transparent"
                      BorderThickness="0"
                      Opacity="0">
                <wpf:PackIcon x:Name="arrow"
                              Width="24" Height="24"
                              Kind="ChevronDown"
                              Foreground="{TemplateBinding BorderBrush}"
                              HorizontalAlignment="Right"
                              VerticalAlignment="Center"
                  />
              </Border>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="splitBorder" Property="Opacity" Value="1"/>
            </MultiDataTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter TargetName="arrow" Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
              <Setter TargetName="arrow" Property="Opacity" Value="0.74" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <Style x:Key="MaterialDesignRotatingMinimalistComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />
    <Setter Property="OverridesDefaultStyle" Value="true" />
    <Setter Property="IsTabStop" Value="false" />
    <Setter Property="Focusable" Value="false" />
    <Setter Property="ClickMode" Value="Press" />
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ToggleButton}">
          <Grid>
            <VisualStateManager.VisualStateGroups>
              <VisualStateGroup x:Name="CheckStates">
                <VisualStateGroup.Transitions>
                  <VisualTransition From="Unchecked" To="Checked">
                    <VisualTransition.GeneratedEasingFunction>
                      <QuarticEase EasingMode="EaseOut"/>
                    </VisualTransition.GeneratedEasingFunction>
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualTransition>
                  <VisualTransition GeneratedDuration="0" To="Unchecked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualTransition>
                  <VisualTransition GeneratedDuration="0" To="Checked">
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualTransition>
                  <VisualTransition From="Checked" GeneratedDuration="0" To="Unchecked">
                    <VisualTransition.GeneratedEasingFunction>
                      <QuarticEase EasingMode="EaseOut"/>
                    </VisualTransition.GeneratedEasingFunction>
                    <Storyboard>
                      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                        <EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
                        <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                      </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Checked">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                      <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="-180"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
                <VisualState x:Name="Unchecked">
                  <Storyboard>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="arrow">
                      <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                    </DoubleAnimationUsingKeyFrames>
                  </Storyboard>
                </VisualState>
              </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="ToggleTemplateRoot"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">
              <Border x:Name="splitBorder"
                      Margin="0"
                      HorizontalAlignment="Right"
                      VerticalAlignment="Center"
                      BorderBrush="Transparent"
                      BorderThickness="0"
                      Opacity="0">
                <wpf:PackIcon x:Name="arrow"
                              Width="24" Height="24"
                              RenderTransformOrigin="0.5,0.5"
                              Kind="ChevronDown"
                              Foreground="{TemplateBinding BorderBrush}"
                              HorizontalAlignment="Right"
                              VerticalAlignment="Center">
                  <wpf:PackIcon.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform/>
                      <SkewTransform/>
                      <RotateTransform/>
                      <TranslateTransform/>
                    </TransformGroup>
                  </wpf:PackIcon.RenderTransform>
                </wpf:PackIcon>
              </Border>
            </Border>
          </Grid>
          <ControlTemplate.Triggers>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="splitBorder" Property="Opacity" Value="1"/>
            </MultiDataTrigger>
            <Trigger Property="IsPressed" Value="true">
              <Setter TargetName="arrow" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
              <Setter TargetName="arrow" Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" />
              <Setter TargetName="arrow" Property="Opacity" Value="0.74" />
            </Trigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <ControlTemplate x:Key="MaterialDesignMinimalistComboBoxTemplate" TargetType="{x:Type ComboBox}">
    <Grid x:Name="templateRoot"
          Background="{TemplateBinding Background}"
          ToolTip="{Binding Path=ToolTip, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}, FallbackValue={x:Null}}"
          SnapsToDevicePixels="True">
      <Grid x:Name="InnerRoot">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        </Grid.ColumnDefinitions>
        <ToggleButton x:Name="toggleButton"
                      Grid.ColumnSpan="2"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}"
                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                      Style="{StaticResource MaterialDesignRotatingMinimalistComboBoxToggleButton}"/>
        <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
              Margin="{TemplateBinding Padding}"
              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
              UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
          <Grid x:Name="InputRoot"
                HorizontalAlignment="Left">
            <ContentPresenter x:Name="contentPresenter"
                              Content="{TemplateBinding SelectionBoxItem}"
                              ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                              IsHitTestVisible="False"/>
            <TextBox x:Name="PART_EditableTextBox"
                     IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                     HorizontalAlignment="Left"
                     HorizontalContentAlignment="Stretch"
                     Style="{StaticResource MaterialDesignComboBoxEditableTextBox}"
                     CaretBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}"
                     Visibility="Collapsed" />

            <wpf:SmartHint x:Name="Hint"
                           HintProxy="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:HintProxyFabricConverter.Instance}}"
                           FontSize="{TemplateBinding FontSize}"
                           SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                           UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                           UseFloating="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingScale="{Binding Path=(wpf:HintAssist.FloatingScale), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingOffset="{Binding Path=(wpf:HintAssist.FloatingOffset), RelativeSource={RelativeSource TemplatedParent}}"
                           HintOpacity="{Binding Path=(wpf:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}">
              <wpf:SmartHint.Resources>
                <system:Double x:Key="DisabledOpacity">1</system:Double><!--TextBlock disabled opacity should not be applied on top of HintOpacity-->
              </wpf:SmartHint.Resources>
              <wpf:SmartHint.Hint>
                <StackPanel Orientation="Horizontal">
                  <ContentPresenter Content="{Binding Path=(wpf:HintAssist.Hint), RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                  <TextBlock Text="*" Margin="4,0,0,0" VerticalAlignment="Center" Visibility="{Binding Path=(DentalGUIHelper:TextboxHelper.IsRequired), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                </StackPanel>
              </wpf:SmartHint.Hint>
            </wpf:SmartHint>
          </Grid>
        </Grid>
        <wpf:Underline x:Name="Underline"
                       Grid.ColumnSpan="2"
                       IsActive="{Binding ElementName=PART_EditableTextBox, Path=IsKeyboardFocused}"
                       Visibility="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/>

        <wpf:ComboBoxPopup x:Name="PART_Popup"
                           AllowsTransparency="true"
                           Background="{DynamicResource MaterialDesignContextMenuBackground}"
                           Focusable="False"
                           HorizontalOffset="-11.5"
                           IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                           PlacementTarget="{Binding ElementName=templateRoot}"
                           SnapsToDevicePixels="True"
                           UseLayoutRounding="True"
                           Placement="Custom"
                           PopupAnimation="Fade"
                           VerticalOffset="0"
                           DefaultVerticalOffset="5"
                           DownVerticalOffset="-15.5"
                           UpVerticalOffset="15"
                           ClassicMode="{Binding Path=(wpf:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}"
                           UpContentTemplate="{StaticResource PopupContentUpTemplate}"
                           DownContentTemplate="{StaticResource PopupContentDownTemplate}"
                           ClassicContentTemplate="{StaticResource PopupContentClassicTemplate}">
          <ContentControl>
            <GroupBox x:Name="ItemContainerGroupBox" Style="{DynamicResource MaterialDesignFlatGroupBox}" Padding="0" MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}">
              <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
                            Background="{DynamicResource MaterialDesignContextMenuBackground}">
                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
              </ScrollViewer>
            </GroupBox>
          </ContentControl>
        </wpf:ComboBoxPopup>
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger SourceName="PART_Popup" Property="PopupPlacement" Value="{x:Static materialdesign:ComboBoxPopupPlacement.Classic}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="wpf:ComboBoxAssist.ClassicMode" Value="True">
        <Setter TargetName="PART_Popup" Property="Placement" Value="Bottom"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Style" Value="{DynamicResource MaterialDesignNoColorRaisedCardGroupBox}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Margin" Value="4"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Padding" Value="0,2"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Background" Value="{DynamicResource MaterialDesignContextMenuBackground}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="MinWidth" Value="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MathAddConverter}, ConverterParameter=15}"/>
      </Trigger>
      <Trigger Property="HasItems" Value="False">
        <Setter TargetName="PART_Popup" Property="IsOpen" Value="False"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="templateRoot" Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1"/>
      </Trigger>
      <Trigger Property="IsEditable" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
        <Setter TargetName="Underline" Property="Visibility" Value="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
      </Trigger>
	  <Trigger Property="DentalGUIHelper:ComboBoxBehavior.IsEditableComboBoxDisableTextBox" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="IsEnabled" Value="false" />
		<Setter TargetName="PART_EditableTextBox" Property="TextWrapping" Value="Wrap" />
		<Setter TargetName="PART_EditableTextBox" Property="AcceptsReturn" Value="True" />
      </Trigger>
      <Trigger Property="wpf:HintAssist.IsFloating" Value="True">
        <Setter TargetName="InnerRoot" Property="Margin" Value="0 11.5 0 0" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsEditable" Value="False"/>
          <Condition Property="IsDropDownOpen" Value="True"/>
          <Condition Property="wpf:ComboBoxAssist.ClassicMode" Value="False"/>
        </MultiTrigger.Conditions>
        <Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
          <Condition SourceName="Hint" Property="IsHintInFloatingPosition" Value="True" />
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition SourceName="PART_EditableTextBox" Property="IsKeyboardFocused" Value="True" />
        </MultiTrigger.Conditions>
        <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition Property="IsDropDownOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter TargetName="Hint" Property="Foreground" Value="{DynamicResource MidContrastPrimaryBrush}" />
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiDataTrigger>
        <MultiDataTrigger.Conditions>
          <Condition Binding="{Binding Path=(IsEditable), RelativeSource={RelativeSource Self}}" Value="True" />
          <Condition Binding="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource Self}}" Value="False" />
          <Condition Binding="{Binding Path=(DentalGUIHelper:TextboxHelper.HintIsVisible), RelativeSource={RelativeSource Self}}" Value="False"/>
        </MultiDataTrigger.Conditions>
        <Setter TargetName="Hint" Property="Visibility" Value="Collapsed" />
      </MultiDataTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsGrouping" Value="true" />
          <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
      </MultiTrigger>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter TargetName="Underline" Property="IsActive" Value="True"/>
      </Trigger>
      <Trigger Property="Validation.HasError" Value="true">
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="IsActive" Value="True"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="true" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="IsActive" Value="True"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource MidContrastPrimaryBrush}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Validation.HasError" Value="True"/>
          <Condition Property="wpf:ValidationAssist.Suppress" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <ControlTemplate x:Key="MaterialDesignColorZoneComboBoxTemplate" TargetType="{x:Type ComboBox}">
    <Grid x:Name="templateRoot"
          Background="{TemplateBinding Background}"
          ToolTip="{Binding Path=ToolTip, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}, FallbackValue={x:Null}}"
          SnapsToDevicePixels="True">
      <Grid x:Name="InnerRoot">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        </Grid.ColumnDefinitions>
        <ToggleButton x:Name="toggleButton"
                      Grid.ColumnSpan="2"
                      Foreground="{TemplateBinding BorderBrush}"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding BorderBrush}"
                      BorderThickness="{TemplateBinding BorderThickness}"
                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                      Style="{StaticResource MaterialDesignNoColorHighlightRotatingComboBoxToggleButton}"/>
        <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
              Margin="{TemplateBinding Padding}"
              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
              UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
          <Grid x:Name="InputRoot"
                HorizontalAlignment="Left">
            <ContentPresenter x:Name="contentPresenter"
                              Content="{TemplateBinding SelectionBoxItem}"
                              ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                              IsHitTestVisible="False"/>
            <TextBox x:Name="PART_EditableTextBox"
                     IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                     HorizontalAlignment="Left"
                     HorizontalContentAlignment="Stretch"
                     Style="{StaticResource MaterialDesignComboBoxEditableTextBox}"
                     CaretBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}"
                     Visibility="Collapsed" />

            <wpf:SmartHint x:Name="Hint"
                           HintProxy="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:HintProxyFabricConverter.Instance}}"
                           FontSize="{TemplateBinding FontSize}"
                           SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                           UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                           UseFloating="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingScale="{Binding Path=(wpf:HintAssist.FloatingScale), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingOffset="{Binding Path=(wpf:HintAssist.FloatingOffset), RelativeSource={RelativeSource TemplatedParent}}"
                           HintOpacity="{Binding Path=(wpf:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}">
              <wpf:SmartHint.Resources>
                <system:Double x:Key="DisabledOpacity">1</system:Double><!--TextBlock disabled opacity should not be applied on top of HintOpacity-->
              </wpf:SmartHint.Resources>
              <wpf:SmartHint.Hint>
                <StackPanel Orientation="Horizontal">
                  <ContentPresenter Content="{Binding Path=(wpf:HintAssist.Hint), RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                  <TextBlock Text="*" Margin="4,0,0,0" VerticalAlignment="Center" Visibility="{Binding Path=(DentalGUIHelper:TextboxHelper.IsRequired), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                </StackPanel>
              </wpf:SmartHint.Hint>
            </wpf:SmartHint>
          </Grid>
        </Grid>
        <Line x:Name="DashedLine" Grid.ColumnSpan="2" VerticalAlignment="Bottom"
              Visibility="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource InverseBoolToVisConverter}}"
              StrokeThickness="1.25" StrokeDashArray="1,2.5" StrokeDashCap="Round"
              X1="0" X2="{Binding ActualWidth, ElementName=toggleButton}" Y1="0" Y2="0"
              Stroke="{TemplateBinding BorderBrush}" />
        <wpf:Underline x:Name="Underline"
                       Grid.ColumnSpan="2"
                       IsActive="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen}"
                       Visibility="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/>

        <wpf:ComboBoxPopup x:Name="PART_Popup"
                           AllowsTransparency="true"
                           TextElement.Foreground="{DynamicResource MaterialDesignContextMenuForeground}"
                           Background="{DynamicResource MaterialDesignContextMenuBackground}"
                           Focusable="False"
                           HorizontalOffset="-11.5"
                           IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                           PlacementTarget="{Binding ElementName=templateRoot}"
                           SnapsToDevicePixels="True"
                           UseLayoutRounding="True"
                           Placement="Custom"
                           PopupAnimation="Fade"
                           VerticalOffset="0"
                           DefaultVerticalOffset="5"
                           DownVerticalOffset="-15.5"
                           UpVerticalOffset="15"
                           ClassicMode="{Binding Path=(wpf:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}"
                           UpContentTemplate="{StaticResource PopupContentUpTemplate}"
                           DownContentTemplate="{StaticResource PopupContentDownTemplate}"
                           ClassicContentTemplate="{StaticResource PopupContentClassicTemplate}">
          <ContentControl>
            <GroupBox x:Name="ItemContainerGroupBox" Style="{DynamicResource MaterialDesignFlatGroupBox}" Padding="0" MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}">
              <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
                            Background="{DynamicResource MaterialDesignContextMenuBackground}">
                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
              </ScrollViewer>
            </GroupBox>
          </ContentControl>
        </wpf:ComboBoxPopup>
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger SourceName="PART_Popup" Property="PopupPlacement" Value="{x:Static materialdesign:ComboBoxPopupPlacement.Classic}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="wpf:ComboBoxAssist.ClassicMode" Value="True">
        <Setter TargetName="PART_Popup" Property="Placement" Value="Bottom"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Style" Value="{DynamicResource MaterialDesignNoColorRaisedCardGroupBox}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Margin" Value="4"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Padding" Value="0,2"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Background" Value="{DynamicResource MaterialDesignContextMenuBackground}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="MinWidth" Value="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MathAddConverter}, ConverterParameter=15}"/>
      </Trigger>
      <Trigger Property="HasItems" Value="False">
        <Setter TargetName="PART_Popup" Property="IsOpen" Value="False"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="templateRoot" Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1"/>
      </Trigger>
      <Trigger Property="IsEditable" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
        <Setter TargetName="Underline" Property="Visibility" Value="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
      </Trigger>
	  <Trigger Property="DentalGUIHelper:ComboBoxBehavior.IsEditableComboBoxDisableTextBox" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="IsEnabled" Value="false" />
		<Setter TargetName="PART_EditableTextBox" Property="TextWrapping" Value="Wrap" />
		<Setter TargetName="PART_EditableTextBox" Property="AcceptsReturn" Value="True" />
      </Trigger>
      <Trigger Property="wpf:HintAssist.IsFloating" Value="True">
        <Setter TargetName="InnerRoot" Property="Margin" Value="0 11.5 0 0" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsEditable" Value="False"/>
          <Condition Property="IsDropDownOpen" Value="True"/>
          <Condition Property="wpf:ComboBoxAssist.ClassicMode" Value="False"/>
        </MultiTrigger.Conditions>
        <Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="wpf:HintAssist.IsFloating" Value="True" />
          <Condition SourceName="Hint" Property="IsHintInFloatingPosition" Value="True" />
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition SourceName="PART_EditableTextBox" Property="IsKeyboardFocused" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition Property="IsDropDownOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiDataTrigger>
        <MultiDataTrigger.Conditions>
          <Condition Binding="{Binding Path=(IsEditable), RelativeSource={RelativeSource Self}}" Value="True" />
          <Condition Binding="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource Self}}" Value="False" />
          <Condition Binding="{Binding Path=(DentalGUIHelper:TextboxHelper.HintIsVisible), RelativeSource={RelativeSource Self}}" Value="False"/>
        </MultiDataTrigger.Conditions>
        <Setter TargetName="Hint" Property="Visibility" Value="Collapsed" />
      </MultiDataTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsGrouping" Value="true" />
          <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
      </MultiTrigger>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter TargetName="Underline" Property="IsActive" Value="True"/>
      </Trigger>
      <Trigger Property="Validation.HasError" Value="true">
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Validation.HasError" Value="True"/>
          <Condition Property="wpf:ValidationAssist.Suppress" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="true" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <ControlTemplate x:Key="MaterialDesignOutlinedFrameLabelComboBoxTemplate" TargetType="{x:Type ComboBox}">
    <Grid x:Name="templateRoot"
          Background="{TemplateBinding Background}"
          ToolTip="{Binding Path=ToolTip, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}, FallbackValue={x:Null}}"
          SnapsToDevicePixels="True">
      <Grid HorizontalAlignment="Left" VerticalAlignment="Top" MinHeight="20" Margin="24,0" IsHitTestVisible="False">
        <ContentPresenter x:Name="frameLabel"
        				VerticalAlignment="Center"
        				Content="{TemplateBinding DentalGUIHelper:TextboxHelper.FrameLabel}"
        				TextElement.Foreground="{TemplateBinding BorderBrush}"
                Opacity="0.76">
          <ContentPresenter.Resources>
            <system:Double x:Key="DisabledOpacity">1</system:Double><!--TextBlock disabled opacity should not be applied on top of HintOpacity-->
          </ContentPresenter.Resources>
        </ContentPresenter>
	  </Grid>
      <Grid x:Name="InnerRoot" Margin="0,12,0,0">
        <Grid.OpacityMask>
          <DrawingBrush Stretch="None" AlignmentX="Left" AlignmentY="Top">
            <DrawingBrush.Drawing>
              <GeometryDrawing>
                <GeometryDrawing.Brush>
                    <SolidColorBrush Color="Blue"/>
                </GeometryDrawing.Brush>
                <GeometryDrawing.Geometry>
                  <GeometryGroup FillRule="EvenOdd" >
                    <RectangleGeometry Rect="0,0,1,1">
                      <RectangleGeometry.Transform>
                        <TransformGroup>
                          <ScaleTransform ScaleX="{Binding ActualWidth, ElementName=templateRoot}"
                                          ScaleY="{Binding ActualHeight, ElementName=templateRoot}" />
                        </TransformGroup>
                      </RectangleGeometry.Transform>
                    </RectangleGeometry>
                    <RectangleGeometry Rect="0,0,1,1">
                      <RectangleGeometry.Transform>
                        <TransformGroup>
                          <ScaleTransform ScaleX="{Binding ActualWidth, ElementName=frameLabel, Converter={StaticResource MathAddConverter}, ConverterParameter=16}"
                                          ScaleY="4" />
                          <TranslateTransform X="16" Y="0"/>
                        </TransformGroup>
                      </RectangleGeometry.Transform>
                    </RectangleGeometry>
                  </GeometryGroup>
                </GeometryDrawing.Geometry>
              </GeometryDrawing>
            </DrawingBrush.Drawing>
          </DrawingBrush>
        </Grid.OpacityMask>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        </Grid.ColumnDefinitions>
        <ToggleButton x:Name="toggleButton"
                      Grid.ColumnSpan="2"
                      Foreground="{TemplateBinding BorderBrush}"
                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                      Style="{StaticResource MaterialDesignNoColorHighlightRotatingComboBoxToggleButton}"
                      Padding="0,0,8,0"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter=0.76}"
                      BorderThickness="{TemplateBinding BorderThickness}"/>
        <Grid x:Name="LayoutRoot"
              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
              Margin="{TemplateBinding Padding}"
              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
              UseLayoutRounding="{TemplateBinding UseLayoutRounding}">
          <Grid x:Name="InputRoot">
            <ContentPresenter x:Name="contentPresenter"
                              Content="{TemplateBinding SelectionBoxItem}"
                              ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                              IsHitTestVisible="False"/>
            <TextBox x:Name="PART_EditableTextBox"
                     IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
                     HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                     VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                     Style="{StaticResource MaterialDesignComboBoxEditableTextBox}"
                     CaretBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}"
                     Padding="{TemplateBinding Padding}"
                     Visibility="Collapsed" />

            <wpf:SmartHint x:Name="Hint"
                           HintProxy="{Binding RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:HintProxyFabricConverter.Instance}}"
                           FontSize="{TemplateBinding FontSize}"
                           SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                           UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                           UseFloating="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingScale="{Binding Path=(wpf:HintAssist.FloatingScale), RelativeSource={RelativeSource TemplatedParent}}"
                           FloatingOffset="{Binding Path=(wpf:HintAssist.FloatingOffset), RelativeSource={RelativeSource TemplatedParent}}"
                           HintOpacity="{Binding Path=(wpf:HintAssist.HintOpacity), RelativeSource={RelativeSource TemplatedParent}}">
              <wpf:SmartHint.Resources>
                <system:Double x:Key="DisabledOpacity">1</system:Double><!--TextBlock disabled opacity should not be applied on top of HintOpacity-->
              </wpf:SmartHint.Resources>
              <wpf:SmartHint.Hint>
                <StackPanel Orientation="Horizontal">
                  <ContentPresenter Content="{Binding Path=(wpf:HintAssist.Hint), RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                  <TextBlock Text="*" Margin="4,0,0,0" VerticalAlignment="Center" Visibility="{Binding Path=(DentalGUIHelper:TextboxHelper.IsRequired), RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                </StackPanel>
              </wpf:SmartHint.Hint>
            </wpf:SmartHint>
          </Grid>
        </Grid>
        <wpf:Underline x:Name="Underline"
                       Grid.ColumnSpan="2"
                       IsActive="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsDropDownOpen}"
                       Visibility="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}"/>

        <wpf:ComboBoxPopup x:Name="PART_Popup"
                           AllowsTransparency="true"
                           TextElement.Foreground="{DynamicResource MaterialDesignContextMenuForeground}"
                           Background="{DynamicResource MaterialDesignContextMenuBackground}"
                           Focusable="False"
                           HorizontalOffset="-11.5"
                           IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                           PlacementTarget="{Binding ElementName=templateRoot}"
                           SnapsToDevicePixels="True"
                           UseLayoutRounding="True"
                           Placement="Custom"
                           PopupAnimation="Fade"
                           VerticalOffset="0"
                           DefaultVerticalOffset="5"
                           DownVerticalOffset="-15.5"
                           UpVerticalOffset="15"
                           ClassicMode="{Binding Path=(wpf:ComboBoxAssist.ClassicMode), RelativeSource={RelativeSource TemplatedParent}}"
                           UpContentTemplate="{StaticResource PopupContentUpTemplate}"
                           DownContentTemplate="{StaticResource PopupContentDownTemplate}"
                           ClassicContentTemplate="{StaticResource PopupContentClassicTemplate}">
          <ContentControl>
            <GroupBox x:Name="ItemContainerGroupBox" Style="{DynamicResource MaterialDesignFlatGroupBox}" Padding="0" MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}">
              <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}"
                            Background="{DynamicResource MaterialDesignContextMenuBackground}">
                <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
              </ScrollViewer>
            </GroupBox>
          </ContentControl>
        </wpf:ComboBoxPopup>
      </Grid>
    </Grid>
    <ControlTemplate.Triggers>
      <Trigger SourceName="PART_Popup" Property="PopupPlacement" Value="{x:Static materialdesign:ComboBoxPopupPlacement.Classic}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="wpf:ComboBoxAssist.ClassicMode" Value="True">
        <Setter TargetName="PART_Popup" Property="Placement" Value="Bottom"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Style" Value="{DynamicResource MaterialDesignNoColorRaisedCardGroupBox}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Margin" Value="4"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Padding" Value="0,2"/>
        <Setter TargetName="ItemContainerGroupBox" Property="Background" Value="{DynamicResource MaterialDesignContextMenuBackground}"/>
        <Setter TargetName="ItemContainerGroupBox" Property="MinWidth" Value="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource MathAddConverter}, ConverterParameter=15}"/>
      </Trigger>
      <Trigger Property="HasItems" Value="False">
        <Setter TargetName="PART_Popup" Property="IsOpen" Value="False"/>
      </Trigger>
      <Trigger Property="IsEnabled" Value="False">
        <Setter TargetName="templateRoot" Property="Opacity" Value="{StaticResource DisabledOpacity}"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BrushToTransmittantBrushConverter}, ConverterParameter={StaticResource DisabledOpacity}}"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1"/>
      </Trigger>
      <Trigger Property="IsEditable" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
        <Setter TargetName="LayoutRoot" Property="Margin" Value="0" />
        <Setter TargetName="Hint" Property="Margin" Value="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter TargetName="Underline" Property="Visibility" Value="{Binding Path=(wpf:TextFieldAssist.DecorationVisibility), RelativeSource={RelativeSource TemplatedParent}}" />
        <Setter TargetName="contentPresenter" Property="Visibility" Value="Collapsed" />
      </Trigger>
	  <Trigger Property="DentalGUIHelper:ComboBoxBehavior.IsEditableComboBoxDisableTextBox" Value="True">
        <Setter TargetName="PART_EditableTextBox" Property="IsEnabled" Value="false" />
		<Setter TargetName="PART_EditableTextBox" Property="TextWrapping" Value="Wrap" />
		<Setter TargetName="PART_EditableTextBox" Property="AcceptsReturn" Value="True" />
      </Trigger>
      <Trigger Property="wpf:HintAssist.IsFloating" Value="True">
        <Setter TargetName="InnerRoot" Property="Margin" Value="0 11.5 0 0" />
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsEditable" Value="False"/>
          <Condition Property="IsDropDownOpen" Value="True"/>
          <Condition Property="wpf:ComboBoxAssist.ClassicMode" Value="False"/>
        </MultiTrigger.Conditions>
        <Setter TargetName="Underline" Property="Visibility" Value="Hidden"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="Transparent"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsKeyboardFocusWithin" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"/>
        <Setter TargetName="frameLabel" Property="Opacity" Value="1"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition SourceName="PART_EditableTextBox" Property="IsKeyboardFocused" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition SourceName="Hint" Property="IsContentNullOrEmpty" Value="False" />
          <Condition Property="IsDropDownOpen" Value="True" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="Hint" Property="HintOpacity" Value="1" />
      </MultiTrigger>
      <MultiDataTrigger>
        <MultiDataTrigger.Conditions>
          <Condition Binding="{Binding Path=(IsEditable), RelativeSource={RelativeSource Self}}" Value="True" />
          <Condition Binding="{Binding Path=(wpf:HintAssist.IsFloating), RelativeSource={RelativeSource Self}}" Value="False" />
          <Condition Binding="{Binding Path=(DentalGUIHelper:TextboxHelper.HintIsVisible), RelativeSource={RelativeSource Self}}" Value="False"/>
        </MultiDataTrigger.Conditions>
        <Setter TargetName="Hint" Property="Visibility" Value="Collapsed" />
      </MultiDataTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsGrouping" Value="true" />
          <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
      </MultiTrigger>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter TargetName="Underline" Property="IsActive" Value="True"/>
      </Trigger>
      <Trigger Property="Validation.HasError" Value="true">
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Validation.HasError" Value="True"/>
          <Condition Property="wpf:ValidationAssist.Suppress" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="true" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderBrush" Value="{DynamicResource ValidationErrorBrush}"/>
        <Setter TargetName="Underline" Property="Background" Value="{DynamicResource ValidationErrorBrush}"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="true" />
          <Condition Property="Validation.HasError" Value="false" />
        </MultiTrigger.Conditions>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter TargetName="toggleButton" Property="BorderBrush" Value="{Binding Path=BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"/>
        <Setter TargetName="frameLabel" Property="Opacity" Value="1"/>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style x:Key="MaterialDesignComboBox" TargetType="{x:Type ComboBox}">
    <Style.Resources>
      <Style TargetType="{x:Type TextBlock}" BasedOn="{x:Null}"/>
    </Style.Resources>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Background" Value="{DynamicResource MaterialDesignComboBoxBackground}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}"/>
    <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
    <Setter Property="BorderThickness" Value="0 0 0 1"/>
    <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="Padding" Value="4" />
    <Setter Property="VerticalContentAlignment" Value="Top" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="HorizontalAlignment" Value="Stretch"/>
    <Setter Property="VerticalAlignment" Value="Center"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
    <Setter Property="ScrollViewer.PanningMode" Value="Both" />
    <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
    <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}"/>
    <Setter Property="wpf:ValidationAssist.Suppress" Value="True"/>
    <Setter Property="wpf:TextFieldAssist.TextBoxViewMargin" Value="1 0 1 0" />
    <Setter Property="wpf:ComboBoxAssist.ClassicMode" Value="True" />
    <Setter Property="wpf:HintAssist.Hint" Value="{Binding Source={StaticResource selectAnOption}, Converter={StaticResource TranslationConverter}}" />
    <Setter Property="TextElement.FontFamily" Value="{StaticResource MaterialDesignFont}"/>
    <Setter Property="Template" Value="{StaticResource MaterialDesignFloatingHintComboBoxTemplate}" />
    <Style.Triggers>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="true">
        <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
      </Trigger>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false" />
        <!-- designer prefers hard bool -->
        <Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" />
      </Trigger>
      <!-- designer prefers hard bool -->
      <Trigger Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" >
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="DentalGUIHelper:TextboxHelper.IsRequired" Value="True">
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorNoAsteriskTemplate}" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="MaterialDesignFloatingHintComboBox"
         BasedOn="{StaticResource MaterialDesignComboBox}"
         TargetType="{x:Type ComboBox}">
    <Setter Property="wpf:HintAssist.IsFloating" Value="True"/>
  </Style>

  <Style x:Key="MaterialDesignMinimalistComboBox" BasedOn="{StaticResource MaterialDesignComboBox}" TargetType="{x:Type ComboBox}">
    <Setter Property="Template" Value="{StaticResource MaterialDesignMinimalistComboBoxTemplate}" />
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}"/>
  </Style>

  <Style x:Key="MaterialDesignColorZoneComboBox" BasedOn="{StaticResource MaterialDesignComboBox}" TargetType="{x:Type ComboBox}">
    <Setter Property="Template" Value="{StaticResource MaterialDesignColorZoneComboBoxTemplate}" />
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="16,4,8,4"/>
    <Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueMidLightForegroundBrush}"/>
    <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidLightForegroundBrush}"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="wpf:TextFieldAssist.DecorationVisibility" Value="Collapsed"/>
    <Style.Triggers>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter Property="BorderThickness" Value="2" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="true">
        <Setter Property="BorderThickness" Value="2" />
      </Trigger>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false" />
        <!-- designer prefers hard bool -->
        <Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" />
      </Trigger>
      <!-- designer prefers hard bool -->
      <Trigger Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" >
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="DentalGUIHelper:TextboxHelper.IsRequired" Value="True">
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorNoAsteriskTemplate}" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="MaterialDesignFilledTextFieldComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}">
    <Setter Property="wpf:TextFieldAssist.HasFilledTextField" Value="True" />
    <Setter Property="wpf:TextFieldAssist.RippleOnFocusEnabled" Value="True" />
    <Setter Property="wpf:TextFieldAssist.TextFieldCornerRadius" Value="4,4,0,0" />
    <Setter Property="wpf:TextFieldAssist.UnderlineCornerRadius" Value="0" />
    <Setter Property="Background" Value="{DynamicResource MaterialDesignZebraBackground}" />
  </Style>

  <Style x:Key="MaterialDesignOutlinedFrameLabelComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}">
    <Setter Property="Template" Value="{StaticResource MaterialDesignOutlinedFrameLabelComboBoxTemplate}"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Padding" Value="12"/>
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="UseLayoutRounding" Value="True"/>
    <Setter Property="BorderBrush" Value="{Binding Foreground, RelativeSource={RelativeSource Self}, FallbackValue=Black}"/>
    <Setter Property="wpf:TextFieldAssist.DecorationVisibility" Value="Collapsed"/>
    <Style.Triggers>
      <Trigger Property="IsKeyboardFocused" Value="true">
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
      </Trigger>
      <Trigger Property="IsKeyboardFocusWithin" Value="true">
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="BorderBrush" Value="{DynamicResource MidContrastPrimaryBrush}" />
      </Trigger>
      <Trigger Property="IsEditable" Value="true">
        <Setter Property="IsTabStop" Value="false" />
        <!-- designer prefers hard bool -->
        <Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" />
      </Trigger>
      <!-- designer prefers hard bool -->
      <Trigger Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" >
        <Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
      </Trigger>
      <Trigger Property="DentalGUIHelper:TextboxHelper.IsRequired" Value="True">
        <Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorNoAsteriskTemplate}" />
      </Trigger>
    </Style.Triggers>
  </Style>

  <Style x:Key="{x:Type ComboBoxItem}" BasedOn="{StaticResource MaterialDesignComboBoxItemStyle}" TargetType="{x:Type ComboBoxItem}" />
  <Style x:Key="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}" TargetType="{x:Type ComboBox}" />

</ResourceDictionary>
